package tests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import base.items.Video;

public class VideoTest {
	private Video v=null;
	private HashSet<Integer> tags = new HashSet<Integer>();
	private HashSet<Integer> comments = new HashSet<Integer>();
	@Before
	public void setup(){
	}

	@After
	public void tearUp(){
		v=null;
		tags=null;
	}

	@Test
	public void constructorNotNull(){
		v=new Video(0, "Avatar", tags,comments,"James Cameron",145);
		assertNotNull(v);
	}

	@Test (expected=IllegalArgumentException.class)
	public void constructorValidId(){
		v=new Video(-1, "Avatar", tags,comments,"James Cameron",145);
	}

	@Test
	public void correctType(){
		v=new Video(0, "Avatar", tags,comments,"James Cameron",145);
		String actual = v.getType();
		String expected = "Video";
		assertTrue(expected.equals(actual));
	}

	@Test
	public void toStringOk(){
		tags.add(12);
		v=new Video(0, "Avatar",tags,comments,"James Cameron",145);
		String actual = v.toString();
		String expected = "Item Id: 0" +
				"\nOwner: 2" +
				"\nType: Video"+
				"\nTitle: Avatar" +
				"\nDirector: James Cameron" +
				"\nLength: 145.0 min"+
				"\n\t* Tag n°" + 12;
//		System.out.println(actual);
//		System.out.println("-------------");
//		System.out.println(expected);
		assertTrue(expected.equals(actual));
	}
}
